Add declarative bind for direct deployment engine#4630
Draft
shreyas-goenka wants to merge 1 commit intomainfrom
Draft
Add declarative bind for direct deployment engine#4630shreyas-goenka wants to merge 1 commit intomainfrom
shreyas-goenka wants to merge 1 commit intomainfrom
Conversation
Collaborator
|
Commit: feb7bb2
16 interesting tests: 7 SKIP, 6 RECOVERED, 3 flaky
Top 20 slowest tests (at least 2 minutes):
|
f7ad1f2 to
34f8a49
Compare
feb7bb2 to
651fdf4
Compare
Allow users to bring existing workspace resources under bundle management declaratively via `bind` blocks under a target. Adds: - `Bind` config type and `bind` field on `Target` in `bundle/config`, with a structural validator that rejects child resources (`*.permissions`, `*.grants`). - `Bind` and `BindAndUpdate` action types in the deploy plan, surfaced in `bundle plan` output (and in the summary as "N to bind"). - `DeploymentBundle.ApplyBindToPlan` (in `bundle/direct/bundle_plan_bind.go`), which runs after `CalculatePlan`, validates bind references, detects bind-ID/state-ID conflicts, and reads remote state to choose `Bind` vs `BindAndUpdate` per resource. - `DeploymentUnit.DeclarativeBind` apply path that persists the bound ID (and optionally invokes `DoUpdate` for `BindAndUpdate`). - Targeted error in `libs/dyn/convert/normalize.go` for `bind` placed at the root level. - Rejection of bind blocks in the terraform path (`RunPlan`), `bundle deployment migrate`, and `bundle destroy` when the bind matches a resource currently in state. Acceptance coverage in `acceptance/bundle/deploy/bind/` covers the happy path (basic, bind_and_update), validation errors (invalid resource type, orphaned bind, top-level bind, duplicate id, terraform engine, child resources), runtime errors (resource not found, recreate blocked), and the destroy / migrate guards. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: Isaac
651fdf4 to
d5c2ca3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add declarative
bindblocks under a target so users can bring existingworkspace resources under bundle management at deploy time without
manually running
bundle deployment bind. Direct engine only — bindblocks under the terraform engine, in
bundle deployment migrate, orunder
bundle destroy(when the bind matches a resource currently instate) all surface actionable errors.
Two new actions show up in
bundle plan:bind— resource is imported, no field changesbind_and_update— resource is imported, drift is appliedDesign
Bindconfig type andbindfield onTargetinbundle/config,plus a structural validator that rejects child resources
(
*.permissions,*.grants).bundle/direct/bundle_plan_bind.go—DeploymentBundle.ApplyBindToPlanruns afterCalculatePlan,validates references, detects ID conflicts, reads remote state, and
selects
BindvsBindAndUpdateper resource.CalculatePlanitselfis unchanged.
DeploymentUnit.DeclarativeBindapply path persists the bound ID(and invokes
DoUpdateforBindAndUpdate).libs/dyn/convert/normalize.goforbindplaced atthe root level (otherwise it would silently degrade to an "unknown
field" warning).
Test plan
Acceptance coverage in
acceptance/bundle/deploy/bind/:basic,bind-and-updateinvalid-resource-type,orphaned-bind,top-level-bind,duplicate-bind-id,terraform-with-bind,bind-permissionsresource-not-found,recreate-blockedblock-migrate,destroy-blocked,delete-and-bind-conflictUnit tests for
bundle/config/bind.go,bundle/config/mutator/validate_bind_resources.go, and the newnormalize-time error in
libs/dyn/convert/normalize.go.This pull request and its description were written by Isaac.